php remove everything after character

35

php remove after character -

$s = 'Posted On April 6th By Some Dude';
echo strstr($s, 'By', true); // Posted On April 6th

php remove everything after symbol -

$variable = substr($variable, 0, strpos($variable, "By"));

Comments

Submit
0 Comments